#ifndef WORD_MAP_H
#define WORD_MAP_H

typedef struct word_map {
    char *str;
    struct word_map *left, *right;
} WordMap;

/*
 * Allocates a new WordMap. A WordMap is an AVL tree for storing strings.
 * Returns NULL (an empty tree is considered to have no nodes).
 */
WordMap *word_map_new();

/*
 * Frees the given map. This operations frees the entire tree (root and children
 * nodes).
 */
void word_map_free(WordMap *map);

/*
 * Adds str to the given map. This operation keeps the internal tree
 * balanced.
 * Returns 0 when successful; 1 otherwise.
 */
int word_map_add(WordMap **map, const char *str);

#endif /* WORD_MAP_H */
